<template>
  <div>
    <div class="index-module">
      <div class="flex-vertical">
        <h2>名医直播</h2>
        <div class="more">更多</div>
      </div>
      <div class="live">
        <div class="item">
          <div class="live-logo">
            <span class="iconfont icon-zhengzaizhibo"></span>
            <p>直播中</p>
          </div>
          <router-link :to="'/live?id=' + dataList.id">
          <img
            :src="dataList.coverImage"
            alt=""
          />
          </router-link>
          <div class="title">{{dataList.title}}</div>
          <div class="avatar flex-vertical">
              <img
                src="https://med-video.cdn.bcebos.com/actplat/59fa02bdd9c1.jpg"
                alt=""
              />
            <span>小明 · 副主任医师</span>
          </div>
          <div class="brief">骨科 广州第一人民医院</div>
          <span class="iconfont icon-renzhengyonghu"></span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import socket from "@/plugins/socketIO";

export default {
  data() {
    return {
      dataList:[]
    };
  },
  created() {
    this.getLiving();
  },
  methods: {
    getLiving() {
      socket.on("indexLiving", (data) => {
        console.log("有直播", data);
        this.dataList = data.data
      });
    },
  },
};
</script>

<style lang='less' scoped>
.flex-vertical {
  position: relative;
  .more {
    position: absolute;
    right: 20px;
  }
}
/* 定义滚动条样式 */
/*定义滚动条高宽及背景
 高宽分别对应横竖滚动条的尺寸*/
::-webkit-scrollbar {
  width: 16px;
  height: 10px;
  background-color: #f5f5f5;
}
/*定义滚动条轨道
 内阴影+圆角*/
::-webkit-scrollbar-track {
  -webkit-box-shadow: inset 0 0 0px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  background-color: #f6f6f6;
}
/*定义滑块
 内阴影+圆角*/
::-webkit-scrollbar-thumb {
  border-radius: 5px;
  -webkit-box-shadow: inset 0 0 0px rgba(0, 0, 0, 0.1);
  background-color: #ccc;
}

.live {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  flex-wrap: nowrap;
  overflow-x: scroll;
  position: relative;
  .item {
    margin-top: 15px;
    height: 250px;
    background-color: #fff;
    border-radius: 15px;
    position: relative;
    .live-logo {
      position: absolute;
      left: 5px;
      top: 5px;
      background-color: #fd503e;
      display: flex;
      align-items: center;
      color: #fff;
      border-radius: 15px;
      width: 70px;
      span {
        font-size: 18px;
        margin: 0px 3px;
      }
      p {
        color: #fff;
      }
    }
    img {
      width: 280px;
      height: 163px;
      border-radius: 15px 15px 0px 0px;
    }
    .title {
      width: 90%;
      margin: 0 auto;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .avatar {
      margin-left: 15px;
      color: #858585;
      line-height: 30px;
      img {
        width: 20px;
        height: 20px;
        border-radius: 50%;
      }
      span {
        font-size: 14px;
        margin-left: 5px;
      }
    }
    .brief {
      font-size: 14px;
      margin-left: 15px;
      color: #858585;
    }
    .icon-renzhengyonghu {
      position: absolute;
      bottom: 10px;
      right: 10px;
      font-size: 21px;
      color: #fad74f;
    }
  }
}
</style>
